package main

import (
	"bufio"
	"fmt"
	"os"
)

/*
@author: wy
@file: 字符压缩.py
@time: 2023/11/16 19:48
*/
func main() {
	print("请输入字符串:")
	x := bufio.NewReader(os.Stdin)
	str1, _ := x.ReadString('\n')
	count := 1
	num := 0
	for i := 0; i < len(str1); i = i + num {
		num = 0
		if i == len(str1)-3 {
			fmt.Printf("%d%c", count, str1[i])
			break
		}
		for j := i + 1; j < len(str1); j++ {

			if str1[i] == str1[j] {
				count++
			} else {
				fmt.Printf("%d%c ", count, str1[i])
				num = num + count
				count = 1
				break

			}

		}

	}

}
